package com.sec.android.app.myfiles.module.shortcut;

import com.sec.android.app.myfiles.facade.cmd.ToSelectModeCmd;
import com.sec.android.app.myfiles.info.AppConstants;
import com.sec.android.app.myfiles.log.SamsungAnalyticsLog;
import com.sec.android.app.myfiles.module.abstraction.FileRecord;
import com.sec.android.app.myfiles.navigation.NavigationInfo;
import com.sec.android.app.myfiles.navigation.NavigationManager;

import org.puremvc.java.multicore.interfaces.INotification;
import org.puremvc.java.multicore.patterns.command.SimpleCommand;

public class ManageShortcutCmd extends SimpleCommand {

    @Override
    public void execute(INotification notification) {
        Object[] params = (Object[]) notification.getBody();
        int processId = (Integer) params[0];
        int position = (Integer) params[1];

        ToSelectModeCmd.SelectModeType selectType = ToSelectModeCmd.SelectModeType.EDIT_MODE;
        FileRecord record = FileRecord.createFileRecord(FileRecord.StorageType.Shortcut, AppConstants.StoragePath.SHORTCUT_FILES);
        NavigationInfo info = NavigationInfo.getInstance(NavigationInfo.NavigationMode.Normal, record);
        if (position > -1) {
            selectType = ToSelectModeCmd.SelectModeType.SELECT_MODE;
            info.setStartSelectionPos(position);
        }
        info.setStartWithSelectMode(selectType);
        info.setScreenPath(SamsungAnalyticsLog.ScreenPath.MANAGE_SHORTCUT);
        NavigationManager.getInstance(processId).enter(info);
    }
}
